package org.zjx.util;

import org.zjx.swing.bean.Font;
import org.zjx.swing.bean.WordBean;
import org.zjx.swing.bean.XmlFonts;

import java.util.ArrayList;
import java.util.Arrays;

public class WordBeanUtil {
    public static XmlFonts wordBeanToXmlFonts (WordBean wordBean){
        Font font = new Font();
        font.setBlock(Arrays.toString(wordBean.getBlock()));
        font.setHigh(wordBean.getHeight());
        font.setWide(wordBean.getWith());
        font.setType(wordBean.getType());
        if (wordBean.getName()!=null){
            font.setName(wordBean.getName());
        }
        ArrayList<Font> arrayList = new ArrayList<>();
        arrayList.add(font);
        XmlFonts xmlFonts = new XmlFonts();
        xmlFonts.setFonts(arrayList);
        return xmlFonts;
    }
}
